@extends('layout.main')

@section('content')
<div class="row m-b-lg m-t-lg">
    <div class="col-md-4">

        <div class="profile-image">
            <img src="/assets/images/dfthead.jpg" class="img-circle circle-border m-b-md" alt="profile">
        </div>
        <div class="profile-info">
            <div>
                <div>
                    <h2 class="no-margins">
                        {{$gadmin->username}}
                    </h2>
                    <h3>{{$gadmin->fullname}}</h3>
                    <h4>@if ($gadmin->role_id>0){{$gadmin->role->name}}@endif</h4>
                </div>
                <div>
                    <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#mymodal">修改密码
                    </button>
                </div>
                <div class="modal inmodal" id="mymodal" tabindex="-1" role="dialog"  aria-hidden="true">
                        <div class="modal-dialog">
                            <div class="modal-content animated fadeIn">
                            <form id="form" method="post" class="form-horizontal" action="/index/modifypwd">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                                    <h4 class="modal-title">修改密码</h4>
                                </div>
                                <div class="modal-body">
                                    <div class="form-group"><label class="col-sm-2 control-label">原密码</label>
                                        <div class="col-sm-10"><input type="password" id="oldpwd" name="oldpwd" class="form-control"></div>
                                    </div>
                                   
                                    <div class="hr-line-dashed"></div>

                                    <div class="form-group"><label class="col-sm-2 control-label">新密码</label>
                                        <div class="col-sm-10"><input type="password" id="newpwd" name="newpwd" class="form-control"></div>
                                    </div>
                                   
                                    <div class="hr-line-dashed"></div>

                                    <div class="form-group"><label class="col-sm-2 control-label">重复密码</label>
                                        <div class="col-sm-10"><input type="password" id="rptpwd" name="rptpwd" class="form-control"></div>
                                    </div>
                                   
                                    <div class="hr-line-dashed"></div>

                                   {!! csrf_field() !!}
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
                                    <button type="submit" class="btn btn-primary">保存</button>
                                </div>
                            </form>
                            </div>
                        </div>
                    </div>
            </div>

        </div>
    </div>
    <div class="col-md-8">
        <table class="table m-b-xs">
            <tbody>
            <tr>
                <td>
                    <strong>Email：</strong>{{$gadmin->email}}
                </td>
                <td>
                    <strong>手机：</strong>{{$gadmin->phone}}
                </td>

            </tr>
            <tr>
                <td>
                    <strong>性别：</strong>@if($gadmin->gender==1)男@else女@endif
                </td>
                <td>

                </td>
            </tr>
            <tr>
                <td>
                    <strong>创建时间：</strong>{{$gadmin->created_at}}
                </td>
                <td>
                    <strong>登录时间：</strong>{{$gadmin->updated_at}}
                </td>
            </tr>
            </tbody>
        </table>
    </div>


</div>
@endsection

@section('js')
<script type="text/javascript">
$("#form").validate({
    rules: {
        oldpwd: {
            required: true
        },
        newpwd: {
            required: true,
            minlength: 6,
            maxlength:16
        },
        rptpwd: {
            required: true,
            equalTo: "#newpwd",
            minlength: 6,
            maxlength:16
        }
    },
    messages: {
        oldpwd: "请输入正确的旧密码",
        newpwd: "请输入6-16位新密码",
        rptpwd: "请重复输入新密码",
    }
});
</script>
@endsection